<extend name="Public/base"/>

<block name="body">
  <div class="main-title">
    <h2>
      新增商品图片
    </h2>
  </div>
    <form action="{:U('Goods/addImg')}" method="post" class="form-horizontal" enctype="multipart/form-data">
    
    <div class="form-item">
      <label class="item-label">图片上传预览:<span class="check-tips"></span></label>
      <div style="width:100%;margin-bottom:200px;">
        <div id="dd" style="width:90%;margin:5px;"></div>
      </div>
    </div>

    <div class="form-item" style="clear: both;">
      <label class="item-label">商品详情图上传<span class="check-tips">（图片格式:jpg,jpeg,png）</span></label>
      <div class="controls">
        <input type="file" class="text input-large" name="picture[]" id="doc" multiple="multiple" style="width:150px;" onchange="javascript:setImagePreviews();"/>
      </div>
    </div>

    <div class="form-item">
      <input type="hidden" name="goods_id" value="{$goods_id|default=''}">
      <button class="btn submit-btn" id="submit" type="submit" target-form="form-horizontal">确 定</button>
      <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
    </div>
  </form>
</block>
<block name="script">

<!-- 引入图片上传预览文件js -->
<script src="__PUBLIC__/Admin/js/setImagePreviews.js"></script>
<!-- 引入图片上传预览文件js -->

<script type="text/javascript" charset="utf-8">
  //商品图片高亮
  highlight_subnav('{:U('addImg')}');

  $('#submit').click(function(){
    var file = $("input[name='picture[]']").val();

    if(!file){
      updateAlert('请选择上传图片');
      setTimeout(function(){
        $(this).removeClass('disabled').prop('disabled',false);
        window.location.href="{:U('Goods/addImg',array('goods_id'=>$goods_id))}";
      },1500);
      return false;
    }
    
  });
</script>
</block>
